<?php
/**
 * The Template for displaying all single posts
 *
 * @package WordPress
 * @subpackage Lebanon_Times
 * @since Lebanon Times 1.0
 */

get_header(); ?>
	<div class="row" style="margin-top: 0px;">
		<div class="span8 pull-right categoryPosts">
			<div id="postContaier">
				<?php 
					while ( have_posts() ) : the_post(); 
					$currentID = get_the_ID();
				?>

					<?php get_template_part( 'content', get_post_format() ); ?>

					<nav class="nav-single">
						<h3 class="assistive-text"><?php _e( 'Post navigation', 'lebanontimes' ); ?></h3>
						<span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'lebanontimes' ) . '</span> %title' ); ?></span>
						<span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'lebanontimes' ) . '</span>' ); ?></span>
					</nav><!-- .nav-single -->

					<?php comments_template( '', true ); ?>

				<?php endwhile; // end of the loop. ?>
				<div id="postsContainer">
	               	<?php 
	               	$categories = get_the_category(get_the_ID());?>
	               	<h1>
	               	مواضيع سابقة
	               	</h1>
	               	<?php
			       	$posts = query_posts($query_string . '&cat='.$categories[0]->term_id);
			       	$search = new WP_Query( "cat=".$categories[0]->term_id );
					if ( $search->have_posts() ) : ?>
					<ul>
						<?php
						/* Start the Loop */
						while ( $search->have_posts() ) : $search->the_post();
							if (get_the_ID() != $currentID) {
						?>
							<li>
								<a href="<?php the_permalink() ?>" target="_parent" class="archiveLink">
									<span class="numeric"><?php the_time('d-m-Y H:i'); ?> - </span>
									<?php the_title(); ?>
								</a>
							</li>
						<?php
							}
						endwhile;

						lebanontimes_content_nav( 'nav-below' );
						?>
					</ul>
					<?php endif; ?>
				</div>
			</div>
		</div>
		<div class="span3 pull-right">
			<?php lebanontimes_get_left_column(); ?>
		</div>
	</div>
<?php get_footer(); ?>